<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
    </h:head>
    <h:body>
        
        <p:dataTable value="#{databaseSelectionBean.availableDatabases}"
                     var="database"
                     id="dataSourcesTable">
            
            <p:column>
                <f:facet name="header">
                    #{resourcesController.extractResource('AVAILABLE_DATASOURCE')}
                </f:facet>
                <div style="width:350px">
                            <h:outputText value="#{database}" style="font-size: 20px"/>
                            <p:graphicImage url="/images/datastorage.png"
                                            styleClass="pictogram" style="float:left;height:45px"/>
                </div>
                
            </p:column>
            <p:column>
                <f:facet name="header">
                    #{resourcesController.extractResource('ACTION')}
                </f:facet>
                <p:commandButton value="#{resourcesController.extractResource('SELECT_DATASOURCE')}"
                                 ajax="false"
                                 async="true"
                                 actionListener="#{databaseSelectionBean.selectDatasource(database)}"
                                 action="/"/>
            </p:column>
            <f:facet name="footer">
                #{resourcesController.extractResource('DATABASE_SELECTION')}
            </f:facet>
        </p:dataTable>
        <p:panel header="hibernate.cfg.xml">
          <h:form>  
            <p:inputTextarea value="#{databaseSelectionBean.hibernateConfigContent}" 
                             style="background-color: black; color:white; width:600px;height:800px"
                             autoResize="true"/><br/>
            <p:commandButton value="#{resourcesController.extractResource('SAVE_CHANGES')}"
                             ajax="false"
                             async="true"
                             actionListener="#{databaseSelectionBean.saveHibernateConfig()}"/>
          </h:form>
        </p:panel>
    </h:body>
</html>

